SpatialStream® Code Examples

Simple Click Identify With UTFGrid

This example shows how to add click identify capability to the parcel layer in your application using the UTFGrid
data. When the map is clicked, an "click" event is triggered and the parcel at the mouse click location will be
highlighted as a canvas layer.


var utfGrid = new Dmp.Layer.UtfGridCanvas(Dmp.Env.Connections["SS"].getBaseUrl() + 'GetUTFGrid.aspx?datasource=samplesite.dmp/parceltiles&z={
z
}&x={
x
}&y={
y
}&obsId=window&obsSuccessMethod={
cb
}&obsErrorMethod={
cb
}&output=json',
{

highlightMinZm: '17',
highlightMaxZm:'18',
clickHL: {

fillColor: 'rgba(255,0,255,0.3)',
fillTileSize: '4',
}
}
);
map.addLayer(utfGrid);

//UTFGrid Events
utfGrid.on('click', function (e) {

//display APN
document.getElementById("displayAPN").innerHTML = "APN: " + e.data.APN + "<br/>House #: " + e.data.HOUSENUM;
});


Run Sample   Back To Index